package com.news.servlet;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import com.news.entity.User;
import com.news.service.UserService;

/**
 * Servlet implementation class modifyPasswordServlet
 */
@WebServlet("/modifyPasswordServlet")
public class ModifyPasswordServlet extends HttpServlet {
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		String id=request.getParameter("id");
		String new_pass=request.getParameter("password");
		System.out.println(id+"  "+new_pass);
		UserService userService=new UserService();
		boolean flag=userService.modifyPassword(Integer.parseInt(id), new_pass);
		System.out.println("成功");
		request.getSession().invalidate();
		response.getWriter().write(flag==true?'1':'0');
System.out.println("03003");
		}
	}
